home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / C++ AppleLink Messages / CPlus.Dev$ 12⁄31⁄89 / 0029-?Initializing a stat-Dec89 < prev    next >
Encoding:
Text File  |  1990-01-02  |  1.0 KB  |  51 lines  |  [TEXT/GEOL]

  1. Item forwarded  by  ALCABES      to CPLUS.APPLE$
  2.  
  3. Item    2579064                         24-Dec-89        05:10
  4.  
  5. From:   MADA.EUROPE                     MacApp Dev Assoc Europe, E Carrasco
  6.  
  7. To:     CPLUS.DEV$                      C++ Interest List--Developers
  8.  
  9. Sub:    ?Initializing a static field
  10.  
  11. Attn:  C++ developers
  12.        ⁄ CPlus.Dev$
  13.  
  14. From:  Eric Carrasco
  15.        MADA Europe
  16.        2, allée des Acacias
  17.        F-95130 Le Plessis Bouchard
  18.        France
  19.        ⁄ MADA.Europe
  20.  
  21. Sub:   Initializing a static field
  22.  
  23.  
  24. Hi all,
  25. A problem with this sample code
  26.  
  27.   Class TFoo {
  28.       private:
  29.          static long   fSize  // variable shared by all instances of the class
  30.                               // acessible from any method of the class
  31.          /* ... */
  32.       public:
  33.          void* IFoo(short size);
  34.          /* ... */
  35.       };
  36.  
  37.    TFoo::IFoo(long size) {
  38.          this->fSize = size;  // kaboom!......why???
  39.       }
  40.  
  41. and this seems to be correct:
  42.  
  43.    long TFoo::fSize = size;  // correct.
  44.  
  45.  
  46. Best Regards,
  47.  
  48. .Eric
  49.  
  50.  
  51.